package top.laoshuzi.designpatterns.base.created.singleton;

/**
 * 懒汉式(同步锁)
 */
public class Singleton2 {

    private static Singleton2 singleton2;

    private String name = "懒汉式(同步锁)";

    public static synchronized Singleton2 getInstance() {
        if (singleton2 == null) {
            singleton2 = new Singleton2();
        }
        return singleton2;
    }

    private Singleton2() {
    }

    public String getName() {
        return name;
    }
}
